package com.aco.party.web.validator.system;

import com.aco.party.web.command.system.EditHireCommand;
import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
import org.springframework.validation.Validator;

/**
* Created by flying on 3/10/2016 0010.
*/
public class EditHireValidator implements Validator {
@Override
public boolean supports(Class<?> aClass) {
return EditHireCommand.class.isAssignableFrom(aClass);
}

@Override
public void validate(Object o, Errors errors) {
    ValidationUtils.rejectIfEmptyOrWhitespace(errors, "name", "error.name.empty", "名字不能为空");
    ValidationUtils.rejectIfEmptyOrWhitespace(errors, "aboutUs", "error.aboutUs.empty", "关于我们不能为空");
    ValidationUtils.rejectIfEmptyOrWhitespace(errors, "address", "error.address.empty", "工作地点不能为空");
    ValidationUtils.rejectIfEmptyOrWhitespace(errors, "iconUrl", "error.iconUrl.empty", "主图不能为空");
    ValidationUtils.rejectIfEmptyOrWhitespace(errors, "discription", "error.discription.empty", "描述不能为空");
}
}
